package concurrent.collection;

import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * 不阻塞的并发队列
 */
public class ConcurrentLinkedQueueTest {
    public static void main(String[] args) {
        ConcurrentLinkedQueue<Integer> queue = new ConcurrentLinkedQueue<>();

        queue.offer(2);
        queue.offer(3);
        queue.offer(1);

        System.out.println(queue.isEmpty());
        System.out.println(queue.size()); //需要遍历整个队列，性能差

        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());


    }
}
